package cn.zucc.edu.bruce.iot.receiver;


import cn.zucc.edu.bruce.iot.DataDeal;

public class ReceiveTemperHumData extends ReceiveSensorData {
    private int temperature;
    private int humidity;

    public ReceiveTemperHumData(byte[] bytes) {
        setSensorNumber(0);
        this.temperature = DataDeal.bytesToInt(bytes, 0);
        this.humidity = DataDeal.bytesToInt(bytes, 4);
    }

    public ReceiveTemperHumData(int temperature, int humidity) {
        this.temperature = temperature;
        this.humidity = humidity;
    }

    public int getTemperature() {
        return temperature;
    }

    public int getHumidity() {
        return humidity;
    }

    @Override
    public String toString() {
        return super.toString() + " temp: " + this.getTemperature() + " hum: " + this.getHumidity();
    }
}
